<?php
include __DIR__ . DIRECTORY_SEPARATOR . "TaskBase.php";

use Plu\qdh\Services\CornService;

$arguments = [];
foreach ($argv as $k => $arg) {
    if ($k == 1) {
        $arguments["task"] = $arg;
    } elseif ($k == 2) {
        $arguments["action"] = $arg;
    } elseif ($k >= 3) {
        $arguments["params"][] = $arg;
    }
}

$service = new CornService;

switch ($arguments["task"]) {
    // 每5分钟执行一次订单过期脚本
    case "expird":
        $service->expireOrders();
        break;
    // 每天11点59开始结算脚本
    case "reportDaily":
        $service->reportDaliyData();
        break;
    case "makeNewAdmin":
        $service->createAdminAccount();
        break;
        
}